package com.huikaka.mapper;

import com.huikaka.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserMapper {

    @Select("select * from user where open_id=#{openId}")
    public User findUserByOpenId(String openId);

    @Insert("insert into `user` (open_id,invite_code,nick_name,header_url,role) values(#{openId},#{inviteCode},#{nickName},#{headerUrl},#{role});")
    public Integer addUser(String openId,String inviteCode,String nickName,String headerUrl,String role);

    @Select("select * from user where invite_code=#{inviteCode}")
    public User findUserByInviteCode(String inviteCode);
}
